#include "lib.h"
#include "syscalls.h"

int DO_SWI();
int DO_SWI0(syscall_num_t id);
int DO_SWI1(syscall_num_t id, unsigned int p1);
int DO_SWI2(syscall_num_t id, unsigned int p1, unsigned int p2);
int DO_SWI3(syscall_num_t id, unsigned int p1, unsigned int p2, unsigned int p3);

void yield(){ DO_SWI0(SYSCALL_ID_YIELD); }

void printf (char *str, ...)
{
    char dest [1024];
    int* argp = (int*) ((unsigned long)(&str) + sizeof(int));
    vsnprintf(dest, 1024, str, argp);
    (void)DO_SWI1(SYSCALL_ID_WRITE, (int)dest);
}
